/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;

/**
 *
 * @author Elizangela
 */
@FacesConverter(value="imovelConverter")
public class ImovelConverter implements Converter {

 @Override
 public Object getAsObject(FacesContext fc, UIComponent uic, String string) {
     Imovel i = new Imovel();
     i.setCodImovel(Integer.parseInt(string));
     return i;
 }

 @Override
 public String getAsString(FacesContext fc, UIComponent uic, Object o) {
    Imovel i = new Imovel(); 
     i = (Imovel) o;
     return i.toString();
    }
}